VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "crystl32.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmPOReport 
   BackColor       =   &H8000000D&
   Caption         =   "Purchase Order Report"
   ClientHeight    =   3405
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6555
   LinkTopic       =   "Form1"
   ScaleHeight     =   3405
   ScaleWidth      =   6555
   StartUpPosition =   2  'CenterScreen
   Begin Crystal.CrystalReport Report 
      Left            =   1800
      Top             =   120
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   348160
      PrintFileLinesPerPage=   60
   End
   Begin VB.CommandButton CmdCancel 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3840
      TabIndex        =   14
      Top             =   2880
      Width           =   1095
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H8000000D&
      Caption         =   "Select by Purchase Order No."
      ForeColor       =   &H8000000E&
      Height          =   975
      Left            =   120
      TabIndex        =   9
      Top             =   720
      Width           =   6255
      Begin MSDataListLib.DataCombo SPONo 
         DataSource      =   "Adodc1"
         Height          =   315
         Left            =   1080
         TabIndex        =   10
         Top             =   360
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "OHPON"
         BoundColumn     =   ""
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo EPONo 
         DataSource      =   "Adodc1"
         Height          =   315
         Left            =   4080
         TabIndex        =   11
         Top             =   360
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "OHPON"
         BoundColumn     =   ""
         Text            =   ""
      End
      Begin VB.Label Label2 
         BackColor       =   &H8000000D&
         Caption         =   "To PO"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Index           =   0
         Left            =   3120
         TabIndex        =   13
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label1 
         BackColor       =   &H8000000D&
         Caption         =   "From PO"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   12
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000D&
      Caption         =   "Select by date"
      ForeColor       =   &H8000000E&
      Height          =   975
      Left            =   120
      TabIndex        =   4
      Top             =   1800
      Width           =   6255
      Begin VB.TextBox TxtEdate 
         Height          =   375
         Left            =   4080
         TabIndex        =   6
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox TxtBdate 
         Height          =   375
         Left            =   1080
         TabIndex        =   5
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label2 
         BackColor       =   &H8000000D&
         Caption         =   "Enddate"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Index           =   1
         Left            =   3120
         TabIndex        =   8
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label1 
         BackColor       =   &H8000000D&
         Caption         =   "Startdate"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Index           =   1
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.OptionButton OptNonf 
      BackColor       =   &H8000000D&
      Caption         =   "Orders not finish"
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   4200
      TabIndex        =   3
      Top             =   360
      Width           =   1575
   End
   Begin VB.OptionButton OptDate 
      BackColor       =   &H8000000D&
      Caption         =   "Select by date"
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   2280
      TabIndex        =   2
      Top             =   360
      Width           =   1575
   End
   Begin VB.OptionButton OptPONo 
      BackColor       =   &H8000000D&
      Caption         =   "Select by PONo."
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   1935
   End
   Begin VB.CommandButton CmdPrint 
      Caption         =   "Print"
      Height          =   375
      Left            =   1320
      TabIndex        =   0
      Top             =   2880
      Width           =   1095
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   495
      Left            =   5400
      Top             =   0
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   873
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "FrmPOReport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ReportType As Integer


Private Sub CmdCancel_Click()
    Reportflg = False
    Unload Me
    Exit Sub
End Sub

Private Sub cmdPrint_Click()
If OptNonf.value = True Then
    Report.ReportFileName = DDAN & "\ReportPurchaseNoFinish.rpt"
    Report.RetrieveStoredProcParams
'    Report.StoredProcParam(0) = Trim(SPONo.Text)
'    Report.StoredProcParam(1) = Trim(EPONo.Text)
    Report.Destination = crptToWindow
    Report.Action = 1
End If
If OptPONo.value = True Then
    Report.ReportFileName = DDAN & "\ReportPurchaseOrder.rpt"
    Report.RetrieveStoredProcParams
    Report.StoredProcParam(0) = Trim(SPONo.Text)
    Report.StoredProcParam(1) = Trim(EPONo.Text)
    Report.Destination = crptToWindow
    Report.Action = 1
End If
If OptDate.value = True Then
    Report.ReportFileName = DDAN & "\PurchaseDate.rpt"
    Report.RetrieveStoredProcParams
    Report.StoredProcParam(0) = Format$(Trim(TxtBdate.Text), "mm/dd/yyyy")
    Report.StoredProcParam(1) = Format$(Trim(TxtEdate.Text), "mm/dd/yyyy")
    Report.Destination = crptToWindow
    Report.Action = 1
End If
End Sub

Private Sub Form_Load()
    Adodc1.ConnectionString = ConnectString
    Adodc1.ConnectionTimeout = 10
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "Select OHPON from POH where isnumeric(OHPON)=1 and OHPOS<>'5' ORDER BY OHPON DESC"
    Adodc1.Refresh
    Set EPONo.RowSource = Adodc1
    Set SPONo.RowSource = Adodc1
    OptPONo.value = False
    OptDate.value = False
    OptNonf.value = False
    Frame1.Enabled = False
    Frame2.Enabled = False
    OptPONo.value = True
'    Reportflg = True
End Sub

Private Sub OptDate_Click()
    OptPONo.value = False
    OptDate.value = True
    OptNonf.value = False
    TxtBdate.Text = ""
    TxtEdate.Text = ""
    SPONo.Text = ""
    EPONo.Text = ""
    Frame1.Enabled = True
    Frame2.Enabled = False
'    ReportType = 2
'    Frame1.Enabled = True
'    Frame2.Enabled = False
    TxtBdate.SetFocus
    End Sub

Private Sub OptNonf_Click()
    OptPONo.value = False
    OptDate.value = False
    OptNonf.value = True
    TxtBdate.Text = ""
    TxtEdate.Text = ""
    SPONo.Text = ""
    EPONo.Text = ""
    Frame1.Enabled = False
    Frame2.Enabled = False
'    ReportType = 3
'    Frame1.Enabled = False
'    Frame2.Enabled = False
    cmdPrint.SetFocus
End Sub

Private Sub OptPONo_Click()
    TxtBdate.Text = ""
    TxtEdate.Text = ""
    SPONo.Text = ""
    EPONo.Text = ""
    Frame1.Enabled = False
    Frame2.Enabled = True
    OptPONo.value = True
    OptDate.value = False
    OptNonf.value = False
End Sub

Private Sub TxtBdate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        TxtEdate.SetFocus
    ElseIf KeyAscii = 27 Then
        Reportflg = False
        Unload FrmPOReport
        
    End If
End Sub

Private Sub TxtEdate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        cmdPrint.SetFocus
    ElseIf KeyAscii = 27 Then
        Reportflg = False
        Unload FrmPOReport
        
    End If
End Sub
